package com.vectrics.hosting;

import javax.servlet.jsp.JspException;

import org.vectrics.domain.Domain;
import org.vectrics.hibernate.ThreadProperties;
import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.struts.VectricsActionData;
import org.vectrics.struts.VectricsStrutsAction;

/**
 * Class to change the look and feel of the FlashRecruit public site.
 * @author Mike Moore
 *
 */
public class ChangeThemeAction extends VectricsStrutsAction {

	/**
	 * Perform action.
	 */
	@Override
	protected String doExecute(VectricsActionData actionData)
			throws JspException {
		
		if (actionData.wasButtonPressed("cancel") == true) {
			
		} else {
			ChangeThemeStrutsForm form = (ChangeThemeStrutsForm)actionData.getForm();
			String themeName = form.getThemeName();
			String domainId = form.getDomainId();
			Domain domain = CoreServiceLocator.getSystemService().findDomain(new Long(domainId));
	
			ChangeThemeHelper helper = new ChangeThemeHelper();
			helper.execute(ThreadProperties.getPerson(), domain, themeName);
		}		
		return "success";
	}
	
	

}
